import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueDevTools from "vite-plugin-vue-devtools";
import path from "path"; // 需要引入 'path' 模块

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    // vueDevTools(),
  ],
  css: {
    preprocessorOptions: {
      less: {
        // 关键配置：在这里引入你的全局变量文件
        // 使用 path.resolve 确保路径正确
        // 假设你的变量文件在 'src/styles/variables.less'
        additionalData: `@import "${path.resolve(
          __dirname,
          "src/assets/css/var.less"
        )}";`,
        javascriptEnabled: true,
      },
    },
  },
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
});
